<template>
  <div>
    <el-aside>
      <el-menu :default-active="defaultActive" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" unique-opened router>
        <el-menu-item index="/home">
          <i class="el-icon-menu"></i>
          <span slot="title">首页</span>
        </el-menu-item>
        <el-submenu :index="item.id.toString()" v-for="item in getUserInfo.menus" :key="item.id">
          <template slot="title">
            <i :class="item.icon"></i>
            <span>{{item.title}}</span>
          </template>
          <el-menu-item :index="menu.url" v-for="menu in item.children" :key="menu.id">{{menu.title}}</el-menu-item>
        </el-submenu>
      </el-menu>
    </el-aside>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
export default {
  data() {
    return {
      defaultActive:'/home',
    };
  },
  computed:{
    ...mapGetters(['getUserInfo'])
  },
  mounted() {
    this.defaultActive=this.$route.path
  },
};
</script>

<style lang="stylus" scoped>
.el-aside
    width 220px !important
    .el-menu
        height 89vh
</style>